package net.orange.architecture.audit;

import net.orange.framework.model.User;

/**
 * The system authority violation message.
 * 
 */
public class SecurityInfo implements IAuditInfo {

	/**
	 * The blocked action URL.
	 */
	private String url;

	/**
	 * The blocked user.
	 */
	private User user;

	/**
	 * The constructor with the blocked action URL and blocked user.
	 * 
	 * @param url
	 *            The blocked URL
	 * @param user
	 *            The blocked user.
	 */
	public SecurityInfo(String url, User user) {
		this.url = url;
		this.user = user;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see net.orange.architecture.audit.IAuditInfo#toInfo()
	 */
	public String toInfo() {
		return (user != null ? user.getUser_name() : "visitor")
				+ " was blocked in resource url:" + url;
	}

	/**
	 * @return Returns the url.
	 */
	public String getUrl() {
		return url;
	}

	/**
	 * @param url
	 *            The url to set.
	 */
	public void setUrl(String url) {
		this.url = url;
	}

	/**
	 * @return Returns the user.
	 */
	public User getUser() {
		return user;
	}

	/**
	 * @param user
	 *            The user to set.
	 */
	public void setUser(User user) {
		this.user = user;
	}

}
